<template>
  <div class="employees-container">
    <div class="app-container">
      <el-card>
        <el-tabs v-model="activeName">
          <el-tab-pane label="登录账户设置">
            <AccountSet name="set" :user-data="userData" />
          </el-tab-pane>
          <el-tab-pane name="detail" label="个人详情">
            <AccountDetail :user-data="userData" />
          </el-tab-pane>
        </el-tabs>
      </el-card>
    </div>
  </div>
</template>

<script>
// 分别导入账号相关两个子组件
import AccountSet from './components/account-set'
import AccountDetail from './components/account-detail'
// 导入获取详情数据的接口
import { getUserDetailById } from '@/api/user'
export default {
  components: {
    AccountSet,
    AccountDetail
  },
  data () {
    return {
      // 用户数据
      userData: {},
      // 当前选中页签name
      activeName: 'detail'
    }
  },
  created () {
    console.log(this.$route)
    this.getDetail()
  },
  methods: {
    // 获取用户详情数据
    async getDetail () {
      const userData = await getUserDetailById(this.$route.params.id)
      this.userData = userData
    }
  }
}
</script>

<style lang="scss" scoped>
</style>
